/* eslint-disable */
import Vue from 'vue'
import Router from 'vue-router'

const Login = resolve => require(['@/views/login/login.vue'], resolve)
const Layout = resolve => require(['@/views/layout/layout.vue'], resolve)
const Compass = resolve => require(['@/views/compass/compass.vue'], resolve)
const HistoryData = resolve => require(['@/views/history/historyData.vue'], resolve)
const Trajectory = resolve => require(['@/views/trajectory/trajectory.vue'], resolve)
const LineRank = resolve => require(['@/views/trajectory/lineRank/lineRank.vue'], resolve)
const LinePath = resolve => require(['@/views/trajectory/linePath/linePath.vue'], resolve)
const TimeInShop = resolve => require(['@/views/trajectory/timeInShop/timeInShop.vue'], resolve)
const ShopTimes = resolve => require(['@/views/trajectory/shopTimes/shopTimes.vue'], resolve)
const Activeness = resolve => require(['@/views/customerSticky/activeness/activeness.vue'], resolve)
const DayActiveness = resolve => require(['@/views/customerSticky/dayActiveness/dayOfActiveness.vue'], resolve)
const Customer = resolve => require(['@/views/customer/customer.vue'], resolve)
const CustomerInfo = resolve => require(['@/views/customer/component/customerInfo.vue'], resolve)
const Management = resolve => require(['@/views/management/management.vue'], resolve)
const GuideList = resolve => require(['@/views/management/component/guideList.vue'], resolve)
const GuideInfo = resolve => require(['@/views/management/component/guideInfo.vue'], resolve)
const ReceptDetail = resolve => require(['@/views/management/component/receptDetail.vue'], resolve)
const Settings = resolve => require(['@/views/settings/settings.vue'], resolve)
const RightsView = resolve => require(['@/views/settings/rightsView/rightsView.vue'], resolve)
const CreateAccount = resolve => require(['@/views/settings/accountManagement/createAccount.vue'], resolve)
const CheckAccount = resolve => require(['@/views/settings/accountManagement/checkAccount.vue'], resolve)
const EditAccount = resolve => require(['@/views/settings/accountManagement/editAccount.vue'], resolve)
const ErrorPage404 = resolve => require(['@/views/errorPages/errorpage404.vue'], resolve)
const ErrorPage403 = resolve => require(['@/views/errorPages/errorpage403.vue'], resolve)



export const constantRouterMap = [
  { path: '/login', name: 'login', component: Login, meta: { title: 'GMALL - 登录' } },
  { path: '/404', component: ErrorPage404, name: 'ErrorPage404', meta: { title: 'GMALL - 404'}},
  { path: '/403', component: ErrorPage403, name: 'ErrorPage403', meta: { title: 'GMALL - 403'}},
]

/**
 * [defaultRouterMap description] 默认的路由栈
 * @type {Array}
 */
export const asyncRouterMap = [
  {
    path: '/index',
    component: Layout,
    children: [
      { path: '/', redirect: '/compass' },
      { path: '/compass', component: Compass, name: 'compass', meta: { title: 'GMALL - 实时罗盘' } },
      { path: '/history', component: HistoryData, name: 'history', meta: { title: 'GMALL - 历史数据' } },
      { path: '/customer/customer-info', component: CustomerInfo, name: 'customerInfo', meta: { title: 'GMALL - 用户信息' } },
      { path: '/trajectory', component: Trajectory, name: 'trajectory', meta: { title: 'GMALL - 动线排行' } },
      { path: '/linerank', component: LineRank, name: 'linerank', meta: { title: 'GMALL - 动线排行' } },
      { path: '/linepath', component: LinePath, name: 'linepath', meta: { title: 'GMALL - 动线路径' } },
      { path: '/timeinshop', component: TimeInShop, name: 'timeinshop', meta: { title: 'GMALL - 逛店时长' } },
      { path: '/shoptimes', component: ShopTimes, name: 'shoptimes', meta: { title: 'GMALL - 逛店频率' } },
      { path: '/activeness', component: Activeness, name: 'activeness', meta: { title: 'GMALL - 活跃度' } },
      { path: '/dayactiveness', component: DayActiveness, name: 'dayactiveness', meta: { title: 'GMALL - 活跃度天数' } },
      { path: '/customer', component: Customer, name: 'customer', meta: { title: 'GMALL - 客群管理' }},
      { path: '/management',
        component: Management,
        meta: { title: 'GMALL - 店铺管理' },
        children: [
          { path: '/management/guidelist', component: GuideList, name: 'GuideList', meta: { title: 'GMALL - 接待详情' }},
          { path: '/management/guideinfo', component: GuideInfo, name: 'GuideInfo', meta: { title: 'GMALL - 导购信息', roles: [1, 2] }},
          { path: '/', redirect: '/management/guidelist'}
        ]
      },
      { path: '/management/receptdetail', component: ReceptDetail, name: 'receptdetail', meta: { title: 'GMALL - 导购详情' }},
      { path: '/settings', component: Settings, name: 'Settings', meta: { title: 'GMALL - 设置', roles: [1, 2]}},
      { path: '/settings/rightsview', component: RightsView, name: 'RightsView', meta: { title: 'GMALL - 角色概况', roles: [1, 2]}},
      { path: '/settings/createaccount', component: CreateAccount, name: 'CreateAccount', meta: { title: 'GMALL - 创建角色', roles: [1, 2]}},
      { path: '/settings/checkaccount', component: CheckAccount, name: 'CheckAccount', meta: { title: 'GMALL - 查看角色', roles: [1, 2]}},
      { path: '/settings/editaccount', component: EditAccount, name: 'EditAccount', meta: { title: 'GMALL - 编辑角色', roles: [1, 2]}},
    ]
  },
  { path: '/', redirect: '/index' },
  { path: '*', redirect: '/404' }
]

Vue.use(Router)

export default new Router({
  routes: constantRouterMap,
  mode: 'history'
})
